home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / lib / X11 / config / mingw.rules < prev    next >
Encoding:
Text File  |  2006-12-20  |  13.4 KB  |  446 lines

  1. /*
  2.  * Cygwin shared library rules (DLL versions)
  3.  */
  4.  
  5. #define HasSharedLibraries      YES
  6. #define NeedLibInsideFlag    NO
  7. #define ForceNormalLib        NO
  8. #define NormalLibX11            NO
  9. # define SharedLibFont        NO
  10. # define SharedLibFontEnc    NO
  11. # define SharedLibWindowsWM    NO
  12. # define SharedLibxkbfile    YES
  13.  
  14. #ifndef SharedDataSeparation
  15. # define SharedDataSeparation    NO
  16. #endif
  17. #ifndef SharedCodeDef
  18. #define SharedCodeDef /**/
  19. #endif
  20. #ifndef SharedLibraryDef
  21. #define SharedLibraryDef /**/
  22. #endif
  23. #ifndef ShLibIncludeFile
  24. #define ShLibIncludeFile <mingw.tmpl>
  25. #endif
  26. #ifndef SharedLibraryLoadFlags
  27. #define SharedLibraryLoadFlags -dll /**/
  28. #endif
  29. #ifndef PositionIndependentCFlags
  30. #define PositionIndependentCFlags -D_DLL
  31. #endif
  32. #ifndef PositionIndependentCplusplusFlags
  33. #define PositionIndependentCplusplusFlags -D_DLL
  34. #endif
  35. #ifndef UseExportLists
  36. #define UseExportLists YES
  37. #endif
  38.  
  39. #define SharedLibraryName(libname, rev) \
  40. Concat3(lib,libname,-$(shell echo rev|sed s=\\..*==).dll)
  41.  
  42. #define ImportLibraryName(libname, rev) \
  43. Concat3(lib,libname,-$(shell echo rev|sed s=\\..*==).dll.a)
  44.  
  45. #define ShortImportLibraryName(libname, rev) \
  46. Concat3(lib,libname,.dll.a)
  47.  
  48. /*
  49.  * SharedDepLibraryTarget - generate rules to create a shared library.
  50.  */
  51.  
  52. #ifndef SharedDepLibraryTarget
  53. # ifdef UseInstalled
  54. #  ifndef LinkBuildSonameLibrary
  55. #   define LinkBuildSonameLibrary(lib)
  56. #  endif
  57. # else /* !UseInstalled */
  58. #  ifndef LinkBuildSonameLibrary
  59. #   define LinkBuildSonameLibrary(lib) (RemoveFile($(BUILDLIBDIR)/lib); @@\
  60.     cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/lib .)
  61. #  endif
  62. # endif /* UseInstalled */
  63.  
  64.  
  65. /*
  66.  * SharedDepLibraryTarget
  67.  */
  68.  
  69. #define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up)    @@\
  70. AllTarget(SharedLibraryName(libname,rev))                             @@\
  71.                                     @@\
  72. SharedLibraryName(libname,rev): deplist                 @@\
  73.     RemoveFile(ImportLibraryName(libname,rev))            @@\
  74.     RemoveFile(SharedLibraryName(libname,rev))            @@\
  75.     MakeDLL(libname,solist,rev)                    @@\
  76.     LinkBuildLibrary(ImportLibraryName(libname,rev))        @@\
  77.     LinkImportLibrary(ImportLibraryName(libname,rev),LibraryTargetName(libname))    @@\
  78.     LinkBuildDLL(SharedLibraryName(libname,rev))            @@\
  79.                                     @@\
  80. clean::                                    @@\
  81.     RemoveFile(ImportLibraryName(libname,rev))                @@\
  82.     RemoveFile(SharedLibraryName(libname,rev))            @@\
  83.  
  84. #endif /* SharedDepLibraryTarget */
  85.  
  86. /*
  87.  * SharedDepCplusplusLibraryTarget - generate rules to create a shared library.
  88.  */
  89.  
  90. #ifndef SharedDepCplusplusLibraryTarget
  91. # ifdef UseInstalled
  92. #  ifndef LinkBuildSonameLibrary
  93. #   define LinkBuildSonameLibrary(lib)
  94. #  endif
  95. # else /* !UseInstalled */
  96. #  ifndef LinkBuildSonameLibrary
  97. #   define LinkBuildSonameLibrary(lib) (RemoveFile($(BUILDLIBDIR)/lib); @@\
  98.     cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/lib .)
  99. #  endif
  100. # endif /* UseInstalled */
  101.  
  102.  
  103. /*
  104.  * SharedDepCplusplusLibraryTarget
  105.  */
  106.  
  107. #define SharedDepCplusplusLibraryTarget(libname,rev,deplist,solist,down,up) @@\
  108. AllTarget(SharedLibraryName(libname,rev))                             @@\
  109.                                                                             @@\
  110. SharedLibraryName(libname,rev): deplist                    @@\
  111.     RemoveFile(ImportLibraryName(libname,rev))                      @@\
  112.     RemoveFile(SharedLibraryName(libname,rev))                      @@\
  113.     MakeCplusplusDLL(libname,solist,rev)                            @@\
  114.     LinkBuildLibrary(ImportLibraryName(libname,rev))                @@\
  115.     LinkImportLibrary(ImportLibraryName(libname,rev),LibraryTargetName(libname))    @@\
  116.     LinkBuildDLL(SharedLibraryName(libname,rev))                    @@\
  117.                                                                         @@\
  118. clean::                                                                 @@\
  119.     RemoveFile(ImportLibraryName(libname,rev))                      @@\
  120.     RemoveFile(SharedLibraryName(libname,rev))                      @@\
  121.  
  122. #endif /* SharedDepCplusplusLibraryTarget */
  123.  
  124.  
  125. /*
  126.  * SharedDepModuleTarget
  127.  */
  128.  
  129. #ifndef SharedDepModuleTarget
  130. #define SharedDepModuleTarget(name,deps,solist)                @@\
  131. AllTarget(name)                                @@\
  132.                                     @@\
  133. name: deps                                @@\
  134.     $(CC) -o $@ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS) BaseShLibReqs @@\
  135.                                     @@\
  136. clean::                                    @@\
  137.     RemoveFile(name)
  138. #endif /* SharedDepModuleTarget */
  139.  
  140.  
  141. /*
  142.  * SharedLibraryDataTarget - generate rules to create shared data file
  143.  */
  144.  
  145. #ifndef SharedLibraryDataTarget
  146. #define SharedLibraryDataTarget(libname,rev,salist)
  147. #endif
  148.  
  149.  
  150. /*
  151.  * InstallSharedLibraryData - generate rules to install the shared library data
  152.  */
  153.  
  154. #ifndef InstallSharedLibraryData
  155. #define InstallSharedLibraryData(libname,rev,dest)
  156. #endif /* InstallSharedLibraryData */
  157.  
  158. /*
  159.  * MakeDllProg
  160.  */ 
  161.     
  162. #define MakeDLLProg(libname,solist,prog,rev)                    @@\
  163.     prog -shared -Wl,--out-implib=ImportLibraryName(libname,rev) -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc -Wl,--exclude-libs,ALL -o SharedLibraryName(libname,rev) solist $(REQUIREDLIBS) -lws2_32
  164.     
  165. /*
  166.  * MakeDll
  167.  */
  168.  
  169. #define MakeDLL(libname,solist,rev)                    @@\
  170.     MakeDLLProg(libname,solist,$(CC),rev)
  171.  
  172. /*
  173.  * MakeCplusplusDll
  174.  */
  175.  
  176. #define MakeCplusplusDLL(libname,solist,rev)                @@\
  177.     MakeDLLProg(libname,solist,$(CXX),rev)
  178.  
  179.  
  180.  
  181. /*
  182.  * SharedLibraryTarget
  183.  */
  184.  
  185. #define SharedLibraryTarget(libname,rev,solist,down,up)                 @@\
  186. AllTarget(SharedLibraryName(libname,rev))                @@\
  187.                                                                         @@\
  188. SharedLibraryName(libname,rev): solist                    @@\
  189.     RemoveFile(ImportLibraryName(libname,rev))            @@\
  190.     RemoveFile(SharedLibraryName(libname,rev))            @@\
  191.     MakeDLL(libname,solist,rev)                    @@\
  192.     LinkBuildLibrary(ImportLibraryName(libname,rev))        @@\
  193.     LinkImportLibrary(ImportLibraryName(libname,rev),LibraryTargetName(libname))    @@\
  194.     LinkBuildDLL(SharedLibraryName(libname,rev))            @@\
  195. clean::                                    @@\
  196.     RemoveFile(ImportLibraryName(libname,rev))            @@\
  197.     RemoveFile(SharedLibraryName(libname,rev))            @@\
  198.  
  199.  
  200. /*
  201.  * InstallLink
  202.  */
  203.  
  204. #ifndef InstallLink
  205. #define InstallLink(step, file, link, dest)                             @@\
  206. step::                                                                  @@\
  207.     MakeDir($(DESTDIR)dest)                                         @@\
  208.     $(LN) -sf file $(DESTDIR)dest/link
  209. #endif
  210.  
  211. /*
  212.  * InstallSharedLibrary
  213.  */
  214.  
  215. #define InstallSharedLibrary(libname,rev,dest)                          @@\
  216. InstallTarget(install,ImportLibraryName(libname,rev),$(INSTLIBFLAGS),$(USRLIBDIR)) @@\
  217. InstallTarget(install,SharedLibraryName(libname,rev),$(INSTBINFLAGS),$(BINDIR)) @@\
  218. InstallLink(install,ImportLibraryName(libname,rev),ShortImportLibraryName(libname,rev),$(USRLIBDIR))
  219.  
  220.  
  221. /*
  222.  * ProgramTargetName - This can be simply 'target' or 'target.exe' when
  223.  * building on Cygwin proper, as Cygwin automatically appends .exe to compiled
  224.  * executables and make, rm, ln, etc. will automatically search for a file
  225.  * with .exe appended if the raw file name cannot be found.  However,
  226.  * building with a cross compiler requires 'target.exe', as the cross
  227.  * compiler doesn't know to append .exe, nor do the cross compiler tools
  228.  * know to search for files with .exe appended if the raw file name cannot
  229.  * be found.
  230.  */
  231.  
  232. #define ProgramTargetName(target) Concat(target,.exe)
  233.  
  234.  
  235. /*
  236.  * HostProgramTargetName - Don't add .exe if cross-compiling.
  237.  */
  238.  
  239. #ifndef HostProgramTargetName
  240. # if CrossCompiling
  241. #  define HostProgramTargetName(target) target
  242. # else
  243. #  define HostProgramTargetName(target) ProgramTargetName(target)
  244. # endif
  245. #endif
  246.  
  247.  
  248. /*
  249.  * LinkBuildDLL - Cygwin only rule, similar to LinkBuildModule.
  250.  * Unfortunately, we have to create a copy of each DLL in xc/exports/bin;
  251.  * linking doesn't work, the executables (e.g. xkbcomp) will report
  252.  * that they cannot find DLLs (e.g. libX11.dll).
  253.  */
  254.  
  255. #ifdef UseInstalled
  256. #define LinkBuildDLL(lib) $(_NULLCMD_)
  257. #else
  258. #define LinkBuildDLL(lib) MakeDir($(BUILDBINDIR))            @@\
  259.     RemoveFile($(BUILDBINDIR)/lib)                    @@\
  260.     cd $(BUILDBINDIR) && $(CP) $(BUILDBINTOP)/$(CURRENT_DIR)/lib .
  261. #endif
  262.  
  263. #ifndef LinkImportLibrary
  264. #ifdef UseInstalled
  265. #define LinkImportLibrary(lib, importlib) $(_NULLCMD_)
  266. #else
  267. #define LinkImportLibrary(lib, importlib) MakeDir($(BUILDLIBDIR))     @@\
  268.     RemoveFile($(BUILDLIBDIR)/importlib)                            @@\
  269.     cd $(BUILDLIBDIR) && $(LN) lib importlib
  270. #endif
  271. #endif /* LinkImportLibrary */
  272.  
  273.  
  274. /*
  275.  * LinkBuildBinary - This rule normally creates a link in xc/exports/bin
  276.  * to a binary, but we create an actual copy of the binary.
  277.  * Creating a link causes the DLLs that the binary depend on, such as
  278.  * libX11.dll, not to be found.  Copying the binary causes the runtime
  279.  * directory to be xc/exports/bin, which is the location of the DLLs, thus,
  280.  * the DLLs can now be found by the binary.  Phew...
  281.  *
  282.  * Note that sometimes the binary is not an executable.  One example
  283.  * is the rgb binary file.
  284.  *
  285.  * Passing -p preserves the attributes as the date and prevents useless
  286.  * rebuilds.
  287.  *
  288.  * ProgramTargetName is passed to LinkBuildBinary if the binary
  289.  * is actually an executable; thus, we do not wrap the binary name
  290.  * with ProgramTargetName here.
  291.  */
  292.  
  293. #ifndef LinkBuildBinary
  294. #define LinkBuildBinary(binary)                        @@\
  295. all:: binary                                @@\
  296.     MakeDir($(BUILDBINDIR))                        @@\
  297.     RemoveFile($(BUILDBINDIR)/binary)                @@\
  298.     cd $(BUILDBINDIR) && $(CP) -p $(BUILDBINTOP)/$(CURRENT_DIR)/binary .
  299. #endif /* LinkBuildBinary */
  300.  
  301. /*
  302.  * ProfiledRelocatableTarget - generate rules to produce a  profiled
  303.  * relocatable object file instead of a library.  Differs from Imake.rules
  304.  * by passing '--oformat pe-i386' to ld.
  305.  */
  306.  
  307. #ifndef ProfiledRelocatableTarget
  308. #define    ProfiledRelocatableTarget(objname,objlist)            @@\
  309. AllTarget(Concat(objname,_p.Osuf))                    @@\
  310.                                     @@\
  311. Concat(objname,_p.Osuf): objlist $(EXTRALIBRARYDEPS)            @@\
  312.     RemoveFile($@)                            @@\
  313.     $(LD) -X -r --oformat pe-i386 objlist -o $@
  314.  
  315. #endif /* ProfiledRelocatableTarget */
  316.  
  317.  
  318. /*
  319.  * DebuggedRelocatableTarget - generate rules to produce a debuggable
  320.  * relocatable object file instead of a library.  Differs from Imake.rules
  321.  * by passing '--oformat pe-i386' to ld.
  322.  */
  323.  
  324. #ifndef DebuggedRelocatableTarget
  325. #define    DebuggedRelocatableTarget(objname,objlist)            @@\
  326. AllTarget(Concat(objname,_d.Osuf))                    @@\
  327.                                     @@\
  328. Concat(objname,_d.Osuf): objlist $(EXTRALIBRARYDEPS)            @@\
  329.     RemoveFile($@)                            @@\
  330.     $(LD) -X -r --oformat pe-i386 objlist -o $@
  331.  
  332. #endif /* DebuggedRelocatableTarget */
  333.  
  334.  
  335. /*
  336.  * DependDependencyStatement - Imake.rules wraps $(DEPEND) in
  337.  * ProgramTargetName(), which causes cross compiling to think that
  338.  * $(DEPEND) hasn't been built, as $(DEPEND) is a host tool, and should
  339.  * not be wrapped with ProgramTargetName().  Perhaps there should be
  340.  * a HostProgramTargetName()...
  341.  */
  342.  
  343. #ifndef DependDependencyStatement
  344. #if HasMakefileSafeInclude
  345. #define DependDependencyStatement()                    @@\
  346. DependFileName:: $(DEPEND)
  347. #else
  348. #define DependDependencyStatement()                    @@\
  349. depend:: $(DEPEND)
  350. #endif
  351. #endif
  352.  
  353.  
  354. /*
  355.  * DependDependency - Imake.rules wraps $(DEPEND) in ProgramTargetName().
  356.  * This doesn't work when cross compiling, see the locally defined
  357.  * DependDependencyStatement comment (above) for more information.
  358.  */
  359.  
  360. #ifndef DependDependency
  361. #ifdef UseInstalled
  362. #define DependDependency() /**/
  363. #else
  364. #define DependDependency()                        @@\
  365. DependDependencyStatement()                        @@\
  366.                                     @@\
  367. NoCmpScript($(DEPEND))                            @@\
  368.                                     @@\
  369. $(DEPEND):                                @@\
  370.     @echo "checking $@ over in $(DEPENDSRC) first..."; \        @@\
  371.     cd $(DEPENDSRC) && $(MAKE) makedependonly; \            @@\
  372.     echo "okay, continuing in $(CURRENT_DIR)"
  373.  
  374. #endif /* UseInstalled */
  375. #endif /* DependDependency */
  376.  
  377.  
  378. /*
  379.  * ImakeDependency - Imake.rules wraps $(IMAKE) in ProgramTargetName(),
  380.  * which doesn't work when cross compiling, as imake is supposed to be a
  381.  * host program.  See the locally defined DependDependencyStatement
  382.  * comment (above) for more information.
  383.  */
  384.  
  385. #ifndef ImakeDependency
  386. #ifdef UseInstalled
  387. #define ImakeDependency(target) /**/
  388. #else
  389. #define ImakeDependency(target)                        @@\
  390. target:: $(IMAKE)                            @@\
  391.                                     @@\
  392. NoCmpScript($(IMAKE) $(IMAKE).Osuf)                    @@\
  393.                                     @@\
  394. $(IMAKE) $(IMAKE).Osuf:                            @@\
  395.     -@(cd $(IMAKESRC) && if [ -f Makefile ]; then \            @@\
  396.     echo "checking $@ in $(IMAKESRC) first..."; $(MAKE) imakeonly; else \    @@\
  397.     echo "bootstrapping $@ from Makefile.ini in $(IMAKESRC) first..."; \    @@\
  398.     $(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; fi; \    @@\
  399.     echo "okay, continuing in $(CURRENT_DIR)")
  400. #endif /* UseInstalled */
  401. #endif /* ImakeDependency */
  402.  
  403.  
  404. /*
  405.  * ResourceObjectRule - Build a Windows resouce file (.res) into
  406.  * an object file (.o) that can be linked in with the executable
  407.  * or library being built.
  408.  */
  409.  
  410. #ifndef ResourceObjectRule
  411. #define ResourceObjectRule(basename,depends,options)            @@\
  412. AllTarget(basename.RESsuf)                        @@\
  413. basename.RESsuf: basename.RCsuf depends                    @@\
  414.     RemoveFile($@)                            @@\
  415.     ClearmakeOSName \                        @@\
  416.     WindresCmd basename.RCsuf options -O coff -o basename.RESsuf    @@\
  417. clean::                                    @@\
  418.     RemoveFiles(basename.RESsuf)
  419.  
  420. #endif /* ResourceObjectRule */
  421.  
  422. /* The arglist can get quite long. Make sure we can delete it though */
  423. #ifndef MakeFonts
  424. # define MakeFonts()                            @@\
  425. all::  $(OBJS)                                @@\
  426.                                     @@\
  427. MakeFontsDir($(OBJS))                            @@\
  428.                                     @@\
  429. clean::                                    @@\
  430.     find -name "*.pcf" -o -name "*.pcf.Z" -o -name "*.pcf.gz" | xargs -r rm
  431. #endif /* MakeFonts */
  432.  
  433. #ifndef IncludeMakefile
  434. #define IncludeMakefile(file) @@sinclude file
  435. #endif
  436.  
  437.  
  438. #ifndef ProjectUnsharedLibReferences
  439. #define ProjectUnsharedLibReferences(varname,libname,libsource,buildlibdir)    @@\
  440. Concat3(DEP,varname,LIB) = _UseCat($(USRLIBDIR)/,buildlibdir/,LibraryTargetName(libname))    @@\
  441. Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname) $(Concat(varname,EXTLIB)) @@\
  442. LintLibReferences(varname,libname,libsource)
  443. #endif
  444.  
  445. XONLYEXTLIB = -lwsock32
  446.